<template>
    <header class="header">
      <div class="logo">
        <a href="/"><img src="/logo.png" alt="公司 logo"></a>
      </div>
      <!-- 选中代码区域，修改导航栏样式 -->
      <nav class="nav">
        <router-link to="/" class="nav-link">首页</router-link>
        <router-link to="/products" class="nav-link">产品介绍</router-link>
        <router-link to="/about" class="nav-link">关于我们</router-link>
      </nav>
    </header>
  </template>

  <style scoped>
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px;
    background-color: #585858;
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }

  .logo {
    font-size: 24px;
    font-weight: bold;
  }

  .logo img {
    height: 30px;
    width: auto;
  }

  .nav {
    display: flex;
    gap: 30px;
  }

  .nav-link {
    color: #333; /* 文字颜色 */
    text-decoration: none; /* 去除下划线 */
    font-size: 16px;
    padding: 8px 0; /* 上下内边距 */
    transition: color 0.3s ease; /* 颜色过渡效果 */
    position: relative;
  }

  .nav-link:hover {
    color: #ff6700; /* 鼠标悬停颜色，小米官网经典橙色 */
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #ff6700;
    transition: width 0.3s ease;
  }

  .nav-link:hover::after {
    width: 100%;
  }

  .router-link-active {
    color: #ff6700;
  }

  .router-link-active::after {
    width: 100%;
  }
  </style>
